<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="keywords" content="AdminLTE,AdminEAP,AdminLTE框架">
    <meta name="description" content="基于AdminLTE的快速开发框架,让web开发更简单">
    <meta property="wb:webmaster" content="4f7a2b4a630250fe" />
    <title>AdminEAP | 登录</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!--icon-->
    <link rel="shortcut icon" type="image/x-icon" href="${basePath}/resources/common/favicon.ico" media="screen"/>
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="${basePath}/resources/adminlte/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="${basePath}/resources/common/libs/font-awesome/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="${basePath}/resources/common/libs/ionicons/css/ionicons.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="${basePath}/resources/adminlte/dist/css/AdminLTE.min.css">
    <!-- iCheck -->
    <link rel="stylesheet" href="${basePath}/resources/adminlte/plugins/iCheck/square/red.css">
    <link rel="stylesheet" href="${basePath}/resources/adminlte/plugins/bootstrap-validator/dist/css/bootstrap-validator.css"/>

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="hold-transition login-page">
<div class="login-box">
    <div class="login-logo">
        <a href="#"><b>Admin</b>EAP</a>
    </div>
    <!-- /.login-logo -->
    <div class="login-box-body">
        <p class="login-box-msg">测试账号 test/bill</p>

        <form action="${basePath}/login" method="post" id="login-form">
            <div class="form-group has-feedback">
                <input type="text" class="form-control"  name="userName" placeholder="请输入登录邮箱/登录名">
                <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
            </div>
            <div class="form-group has-feedback">
                <input type="password" class="form-control" name="password" placeholder="请输入密码">
                <span class="glyphicon glyphicon-lock form-control-feedback"></span>
            </div>
            <div class="row">
                <div class="col-xs-6">
                    <div class="checkbox icheck">
                        <label>
                            <input type="checkbox" name="rememberMe"> 下次自动登录
                        </label>
                    </div>
                </div>
                <!-- /.col -->
                <div class="col-xs-6">
                    <div class="checkbox pull-right">
                        <a href="#">忘记密码</a>
                        <span>&nbsp;/&nbsp;</span>
                        <a href="${basePath}/register" class="text-center">注册</a>
                    </div>
                </div>
                <!-- /.col -->
            </div>
            <div class="row">
                <div class="col-xs-12">
                    <button type="submit" class="btn btn-danger btn-block btn-flat">登 录</button>
                </div>
            </div>
        </form>


        <div class="social-auth-links" style="margin-bottom: 0px;">
            <div class="row">
                <div class="col-xs-5">
                    <div class="text-left" style="margin-top: 5px;">快速登录</div>
                </div>
                <div class="col-xs-7">
                    <div class="text-right">
                        <!--<a class="btn btn-social-icon btn-primary"><i class="fa fa-qq"></i></a>
                        <a class="btn btn-social-icon btn-success"><i class="fa fa-wechat"></i></a>
                        <a class="btn btn-social-icon btn-warning"><i class="fa fa-weibo"></i></a>
                        <a class="btn btn-social-icon btn-info"><i class="fa fa-github"></i></a>-->
                        <#list oAuthServices as oauth>
                            <a class="btn btn-social-icon ${oauth.btnClass}" href="${oauth.authorizationUrl}"><i class="fa fa-${oauth.oAuthType}"></i></a>
                        </#list>
                    </div>
                </div>
            </div>
            <!-- /.social-auth-links -->
        </div>
        <!-- /.login-box-body -->
    </div>
    <!-- /.login-box -->
</div>
    <!-- jQuery 2.2.3 -->
    <script src="${basePath}/resources/adminlte/plugins/jQuery/jquery-2.2.3.min.js"></script>
    <!-- Bootstrap 3.3.6 -->
    <script src="${basePath}/resources/adminlte/bootstrap/js/bootstrap.min.js"></script>
    <!-- iCheck -->
    <script src="${basePath}/resources/adminlte/plugins/iCheck/icheck.min.js"></script>
    <!-- bootstrap-validator-->
    <script src="${basePath}/resources/adminlte/plugins/bootstrap-validator/dist/js/bootstrap-validator.js"></script>
    <!--login.js-->
    <script src="${basePath}/resources/common/js/login.js"></script>
    <script>
        $(function () {
            $('input').iCheck({
                checkboxClass: 'icheckbox_square-red',
                radioClass: 'iradio_square-red',
                increaseArea: '20%' // optional
            });

            fillbackLoginForm();
            $("#login-form").bootstrapValidator({
                message:'请输入用户名/密码',
                submitHandler:function (valiadtor,loginForm,submitButton) {
                    rememberMe($("input[name='rememberMe']").is(":checked"));
                    valiadtor.defaultSubmit();
                },
                fields:{
                    userName:{
                        validators:{
                            notEmpty:{
                                message:'登录邮箱名或用户名不能为空'
                            }
                        }
                    },
                    password:{
                        validators:{
                            notEmpty:{
                                message:'密码不能为空'
                            }
                        }
                    }
                }
            });

            <#if message??>
                new LoginValidator({
                    code:"${message.code?default('-1')}",
                    message:"${message.message?default('')}",
                    userName:'userName',
                    password:'password'
                });
            </#if>
        });



        //使用本地缓存记住用户名密码
        function rememberMe(rm_flag){
            //remember me
            if(rm_flag){
                 localStorage.userName=$("input[name='userName']").val();
                 localStorage.password=$("input[name='password']").val();
                localStorage.rememberMe=1;
            }
            //delete remember msg
            else{
                localStorage.userName=null;
                localStorage.password=null;
                localStorage.rememberMe=0;
            }
        }

        //记住回填
        function fillbackLoginForm(){
            if(localStorage.rememberMe&&localStorage.rememberMe=="1"){
                $("input[name='userName']").val(localStorage.userName);
                $("input[name='password']").val(localStorage.password);
                $("input[name='rememberMe']").iCheck('check');
                $("input[name='rememberMe']").iCheck('update');
            }
        }
    </script>
</body>
</html>
